home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / assign manager / assignx / noreq.c < prev    next >
C/C++ Source or Header  |  1996-04-07  |  2KB  |  73 lines

  1. /************************************************************************/
  2. /*  EasyRequest trapper - deals with requests for nonexistant volumes   */
  3. /*                        V1.0, by Steve Tibbett                        */
  4. /************************************************************************/
  5. #include <Stdio.h>
  6. #include <libraries/gadtools.h>
  7. #include <intuition/intuition.h>
  8. #include <proto/gadtools.h>
  9. #include <proto/asl.h>
  10. #include <proto/exec.h>
  11. #include <proto/dos.h>
  12. #include <dos/dos.h>
  13. #include <exec/memory.h>
  14. #include <string.h>
  15. #include <ctype.h>
  16.  
  17. struct Library *IntuitionBase;
  18. struct Library *AslBase;
  19. struct Library *GfxBase;
  20. struct Remember *Remember;
  21.  
  22. void MemCleanup(void) { }
  23.  
  24. void *OrigFunc;
  25. void *OurVec;
  26.  
  27. /************************************************************************/
  28. /*                        The new "EasyRequest"                         */
  29. /************************************************************************/
  30. int __saveds __interrupt __asm
  31. NewFunc(register __a0 struct Window *Win, register __a1 struct EasyStruct *EZ,
  32. register __a2 ULONG *idcmp, register __a3 ULONG *args)
  33. {
  34. int Res;
  35.  
  36. if (args && args[0])
  37.     {
  38.     if (strcmp((char *)args[0], "Please insert volume")==0)
  39.         return(0);
  40.  
  41.     if (strcmp((char *)EZ->es_GadgetFormat, "Suspend|Reboot")==0)
  42.         return(0);
  43.     };
  44.  
  45. Res=MyFunc(Win, EZ, idcmp, args);
  46. return(Res);
  47. }
  48.  
  49.  
  50. main()
  51. {
  52. IntuitionBase=OpenLibrary("intuition.library", 36);
  53. AslBase=OpenLibrary("asl.library", 36);
  54. if (IntuitionBase==0 || AslBase==0)
  55.     return(10);
  56.  
  57. OrigFunc=SetFunction(IntuitionBase, -0x24c, NewFunc);
  58. if (OrigFunc==0)
  59.     return(15);
  60.  
  61. Wait(SIGBREAKF_CTRL_C);
  62.  
  63. OurVec=SetFunction(IntuitionBase, -0x24c, OrigFunc);
  64.  
  65. if (OurVec!=NewFunc)
  66.     EasyRequester(NULL, "AssignX Request", "Error removing wedge!\nReboot soon!", "Okay");
  67.  
  68. FreeRemember(&Remember, TRUE);
  69. CloseLibrary(IntuitionBase);
  70. CloseLibrary(AslBase);
  71. return(0);
  72. }
  73.